<?php
defined('BASEPATH') OR exit('No direct script access allowed');


class LitigationCenter extends CI_Controller
{

	public function __construct()
	{
		parent::__construct();
	//	$this->load->model('Access_Token_Model');
		$this->load->library('PhpCrawler');
	//	$this->load->model('Access_Token_Model');
		$this->load->library('HttpPost');
		$this->load->helper('url_helper');
		$this->load->library('session');
		$this->load->model('Onduty_Model');
	}
	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 *        http://example.com/index.php/welcome
	 *    - or -
	 *        http://example.com/index.php/welcome/index
	 *    - or -
	 * Since this controller is set as the default controller in
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see https://codeigniter.com/user_guide/general/urls.html
	 */
	public function index()
	{
		if(empty($this->session->userdata('user'))){
			$uri=$this->uri->uri_string();
			$array=array('uri'=>$uri);
			$this->session->set_userdata($array);
			header("Location:UserInfoAuth/auth");
		}

		$data=array('title'=>'诉服中心');

		$user=$this->session->userdata('user');
		$openid=$user['openid'];
		$is_server=$this->check_if_server($openid);
		$data['is_server']=$is_server;
		$this->load->view('head_sec',$data);
		$this->load->view('litigation_center');
		$this->load->view('foot_sec',$data);
	}

	public function check_if_server($openid){
		$param['openid']=$openid;
		$duties=$this->Onduty_Model->get_onduty_by_param($param);
		if(empty($duties)||count($duties)==0){
			return 0;
		}else{
			return 1;
		}
	}

}


